package com.jxwifi.cloud.quickclean.adapter;

import android.support.annotation.LayoutRes;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.jxwifi.cloud.quickclean.R;
import com.jxwifi.cloud.quickclean.app.StateUtils;
import com.jxwifi.cloud.quickclean.bean.ShopRechargeBean;

public class SetMealAdapter extends BaseQuickAdapter<ShopRechargeBean, BaseViewHolder> {

    public SetMealAdapter(@LayoutRes int layoutResId) {
        super(layoutResId, null);
    }

    @Override
    protected void convert(BaseViewHolder helper, ShopRechargeBean item) {

        //选中布局 shap_set_meal 未选中布局shap_set_meal_nu
        if (item.isChechCK()){
            helper.getView(R.id.rel_set_meal_list).setBackgroundResource(R.drawable.shap_set_meal);
        }else{
            helper.getView(R.id.rel_set_meal_list).setBackgroundResource(R.drawable.shap_set_meal_nu);
        }
        helper.setText(R.id.tv_set_meal_name, item.getRechargeTitle());
        helper.setText(R.id.tv_set_meal_content, item.getRechargeDescribe());
        if(StateUtils.APPOINT_DATE.equals(item.getTimeType())){
            helper.setText(R.id.tv_set_meal_time, "套餐优惠时间：" + item.getStartTime() + "至" + item.getEndTime());
        }else if (StateUtils.NONE.equals(item.getTimeType())){
            helper.setText(R.id.tv_set_meal_time, "");
        }
        helper.setText(R.id.tv_set_meal_price, "\u00A5" + item.getRechargeAmount());
    }
}
